<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 200px;
            height: 100px;
            padding: 10px;
            border: 2px solid red;
        }
    </style>
</head>
<body>
    <div>div标签</div>

    <script>
        var div = document.querySelector('div')
        // 1.元素+padding+border
        var height1 = div.offsetHeight
        var width1 = div.offsetWidth
        console.log(height1,width1)

        // 2.元素+padding
        var height2 = div.clientHeight
        var width2 = div.clientWidth
        console.log(height2,width2)
    </script>
</body>
</html>